﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using App.Core.Extensions;
using App.Domain;
using App.Web.ViewModels;
using App.Web.Utility;
using AutoMapper;
using App.Web.ViewModels.UtilityModels;

namespace App.Web.Areas.Private.Controllers
{
    [Authorize(Roles = "Company Admin,Company User,Site User")]
    public class FavoritesController : BaseController
    {
		private AppEntities _Context = new AppEntities();
        
		#region Constructors
		public FavoritesController()
		{
		}

		public FavoritesController(UserViewModel currentUser)
			: base(currentUser)
        {
        }
		#endregion Constructors

		#region Action Methods

        /// <summary>
        /// Get List Of Product Added To Wish List
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public ActionResult Index(String id)
        {
            PagerConfig pagerConfig = new PagerConfig(id.ToInt() > 0 ? id.ToInt() : 1, ConfigReader.pageSize, 0);
            UtilityDAO dao = new UtilityDAO();
            DbParameter[] parameters = new[] {            
                new DbParameter("@UserId", SessionCache.CurrentUser.ID),
            };
            int totalRecord = 0;
            System.Data.DataSet ds =
                dao.GetPagedData(DbObject.SP.GET_PRODUCT_FROM_WISH_LIST,
                parameters, pagerConfig.PageNo, pagerConfig.PageSize, out totalRecord, true);
            pagerConfig.TotalRecord = totalRecord;            
            ViewBag.SearchType = "WishList";            
            ListConfig listConfig = new ListConfig(ds.Tables[0], pagerConfig);

            return View(listConfig);
        }
		#endregion Action Methods
		
		#region Helper Methods

        #endregion			
    }
}
